<h1><code ng:non-bindable="">$compileProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/compile.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="directive">directive(name, directiveFactory)</h3>
<div class="directive"><p>Register a new directives with the compiler.</p><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><p>Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
<code>ng-bind</code>).</p></td></tr><tr><td>directiveFactory</td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><p>An injectable directive factory function. See <a href="guide/directive">guide/directive</a> for more
info.</p></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-ng">ng.$compileProvider</a></td><td><p>Self for chaining.</p></td></tr></table></div>
</li>
<li><h3 id="urlSanitizationWhitelist">urlSanitizationWhitelist(regexp)</h3>
<div class="urlsanitizationwhitelist"><p>Retrieves or overrides the default regular expression that is used for whitelisting of safe
urls during a[href] sanitization.</p>

<p>The sanitization is a security measure aimed at prevent XSS attacks via html links.</p>

<p>Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
absolute url. Afterwards the url is matched against the <code>urlSanitizationWhitelist</code> regular
expression. If a match is found the original url is written into the dom. Otherwise the
absolute url is prefixed with <code>'unsafe:'</code> string and only then it is written into the DOM.</p><h5 id="parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>regexp <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><p>New regexp to whitelist urls with.</p></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-regexp">RegExp|ng.$compileProvider</a></td><td><p>Current RegExp if called without value or self for
chaining otherwise.</p></td></tr></table></div>
</li>
</ul>
</div>
</div>
